import request from '@/plugins/axios'

export function validateCardNum(query){
    return request({
        url: '/api/propertycard/validate',
        method: 'get',
        params: query
    })
}

export function query(query){
    return request({
        url: '/api/propertycard/page',
        method: 'get',
        params: query
    })
}

export function get(id) {
    return request({
        url: '/api/propertycard/'+id ,
        method: 'get'
    })
}
export function deleteData(ids){
    return request.delete('/api/propertycard/'+ids)
}

export function addData(data) {
    return request.post('/api/propertycard',  data)
}

export function updateData(data) {
    return request.put('/api/propertycard',  data)
}

//根据父级Id获取关联物业信息
export function getRelevancyPropertys(pid) {
    return request.get('/api/propertycard/getRooms/' + pid )
}


export function fileUpload(formData){
    return request.post('/admin/sys-file/upload', formData)
    // return request.post('/admin/sys-file/upload', formData, {headers: {'Content-Type': 'multipart/form-data'}})
    // return request({
    //     url: '/admin/sys-file/multipart_file/upload',
    //     method: 'post',
    //     data: data
    // })
}

export function getFiles(id){
    return request.get('/api/propertycard/getFiles/'+id)
}


export function downloadFiles(id){

    return request.get('/api/propertycard/download/'+id)
}

export function deleteFile(id){
    return request.delete('/admin/sys-file/'+id)
}

//hxf-0918-分页
export function realEstatePage(query){
    return request({
        url: '/api/realEstate/page',
        method: 'get',
        params: query
    })
}
//hxf-0918-新增
export function realEstateAdd(data){
    return request({
        url: '/api/realEstate',
        method: 'post',
        data: data
    })
}
//hxf-0918-获取关联物业列表信息
export function getRooms(id){
    return request({
        url: '/api/realEstate/getRooms/' + id,
        method: 'get'
    })
}
//hxf-0918-获取政府投资项目列表信息
export function getAssetRegistrationList(){
    return request({
        url: '/api/realEstate/getAssetRegistrationList',
        method: 'get'
    })
}
//hxf-0918-获取政府投资项目信息
export function getAssetRegistration(id){
    return request({
        url: '/api/realEstate/getAssetRegistration/' + id,
        method: 'get'
    })
}
//hxf-0918-编辑
export function realEstateEdit(data){
    return request({
        url: '/api/realEstate',
        method: 'put',
        data: data
    })
}
//hxf-0918-验证产权证号唯一
export function validateCardNumber(query){
    return request({
        url: '/api/realEstate/validateCardNumber',
        method: 'get',
        params: query
    })
}
//hxf-0918-查看
export function getRealEstate(id){
    return request({
        url: '/api/realEstate/' + id,
        method: 'get'
    })
}
//hxf-0918-删除
export function realEstateDelect(data){
    return request({
        url: '/api/realEstate/delete',
        method: 'post',
        data: data
    })
}
//hxf-0918-验证资产名称唯一
export function validateAssetsName(query){
    return request({
        url: '/api/realEstate/validateAssetsName',
        method: 'get',
        params: query
    })
}
//政府投资项目列表接口
export function getGovernmentPage(query){
    return request({
        url: '/api/asset/registration/page',
        method: 'get',
        params: query
    })
}
//所属项目选中调用接口
export function getProjectAndLand(id){
    return request({
        url: '/api/propertybasic/getProjectAndLand/' + id,
        method: 'get'
    })
}
